package com.xls.future.utils;

import android.content.Context;
import android.util.DisplayMetrics;

/**
 * Created by Administrator on 2017/8/29.
 */

public class ScreenUtil {

    public static int getScreenWidth(Context context){
        DisplayMetrics displayMetrics  = context.getResources().getDisplayMetrics();
        return displayMetrics.widthPixels;
    }

    public static int getScreenHeight(Context context){
        DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
        return displayMetrics.heightPixels;
    }


    /*
   * converts dip to px
   */
    public static int dip2Px(float dip,Context context) {
        return (int) (dip * context.getResources().getDisplayMetrics().density + 0.5f);
    }

}
